package com.junzhiit.nengji.shop.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum FreeConditionType {
	
	PRICE(0),
	QUALITY(1);
	
	private Integer value;
	
	private FreeConditionType(Integer value){
		this.value = value;
	}

	public int toIntValue() {
		return this.value;
	}

	public static FreeConditionType toValue(int value) {
		if (PRICE.value == value) {
			return PRICE;
		} else if (QUALITY.value == value) {
			return QUALITY;
		} else {
			throw new InvalidArgumentException("Unknown is[" + value + "].");
		}
	}
}
